package com.zzedu.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzedu.common.utils.StringUtils;
import com.zzedu.domain.ZzMessage;
import com.zzedu.dto.ZzMessageDTO;
import com.zzedu.mapper.ZzMessageMapper;
import com.zzedu.service.IZzMessageService;
import org.springframework.stereotype.Service;
/**
 * 通知消息Service业务层处理
 * 
 * @author Mr.Wang
 * @date 2025-03-15
 */
@Service
public class ZzMessageServiceImpl extends ServiceImpl<ZzMessageMapper,ZzMessage> implements IZzMessageService
{

    @Override
    public LambdaQueryWrapper<ZzMessage> buildQuery(ZzMessageDTO zzMessage) {
        LambdaQueryWrapper<ZzMessage> lambdaQueryWrapper = Wrappers.lambdaQuery();
        lambdaQueryWrapper.eq(null!=zzMessage.getNoticeType(), ZzMessage::getNoticeType, zzMessage.getNoticeType());
        lambdaQueryWrapper.eq(StringUtils.isNotBlank(zzMessage.getTitle()), ZzMessage::getTitle, zzMessage.getTitle());
        lambdaQueryWrapper.eq(null!=zzMessage.getReadFlag(), ZzMessage::getReadFlag, zzMessage.getReadFlag());

        lambdaQueryWrapper.orderByDesc(ZzMessage::getId);
        return lambdaQueryWrapper;
    }
}